home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / plnk081.zip / pilot-link.0.8.1 / include / pi-address.hxx < prev    next >
Text File  |  1997-05-23  |  2KB  |  84 lines

  1. #include "pi-appinfo.hxx"
  2.  
  3. const int ADDRESS_APP_INFO_SIZE = 638;
  4.  
  5. typedef char addressLabels_t[22][16];
  6. typedef char addressPhoneLabels_t[8][16];
  7.  
  8. class addressAppInfo_t : public appInfo_t
  9. {
  10.      unsigned long _dirtyFieldLabels;
  11.      addressLabels_t _labels;
  12.      addressPhoneLabels_t _phoneLabels;
  13.      int _country;
  14.      int _sortByCompany;
  15.      
  16.    public:
  17.      addressAppInfo_t(void *);
  18.  
  19.      void *pack(void);
  20.  
  21.      const addressLabels_t &labels(void) const { return _labels; }
  22.      const addressPhoneLabels_t &phoneLabels(void) const { return _phoneLabels; }
  23.      int country(void) const { return _country; }
  24.      int sortByCompany(void) const { return _sortByCompany; }
  25. };
  26.  
  27. class addressList_t;    // Forward declaration
  28.  
  29. class address_t : public baseApp_t
  30. {
  31.      int _phoneLabels[5];
  32.      int _whichPhone;
  33.  
  34.      char *_entry[19];
  35.      
  36.      friend addressList_t;
  37.      
  38.      address_t *_next;
  39.  
  40.      void *internalPack(unsigned char *);
  41.      
  42.    public:
  43.      enum labelTypes_t {
  44.       lastName, firstName, company, phone1, phone2, phone3, phone4,
  45.       phone5, address, city, state, zip, country, title, custom1,
  46.       custom2, custom3, custom4, note
  47.      };
  48.  
  49.      address_t(void *buf) { unpack(buf, 1); }
  50.      address_t(void) { memset(this, '\0', sizeof(address_t)); }
  51.      address_t(void *buf, int attr, recordid_t id, int category)
  52.       : baseApp_t(attr, id, category)
  53.       {
  54.            unpack(buf, 1);
  55.       }
  56.      address_t(const address_t &);
  57.      
  58.      ~address_t(void);
  59.  
  60.      char *entry(labelTypes_t idx) { return _entry[idx]; }
  61.      int whichPhone(void) const { return _whichPhone; }
  62.      
  63.      void unpack(void *, int = 0);
  64.  
  65.      void *pack(int *);
  66.      void *pack(void *, int *);
  67. };
  68.  
  69. class addressList_t 
  70. {
  71.      address_t *_head;
  72.      
  73.    public:
  74.      addressList_t(void) : _head(NULL) { }
  75.      ~addressList_t();
  76.      
  77.      address_t *first() { return _head; }
  78.      address_t *next(address_t *ptr) { return ptr->_next; }
  79.  
  80.      void merge(address_t &);
  81.      void merge(addressList_t &);
  82. };
  83.  
  84.